#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
int main()
{
    long long n, ans = 1, count = 1,rem = 0;
    cin >> n;
    while (ans % n != 0)
    {
        ans = ans*10 + 1;
        count++;
        rem = ans % n;
    }
    ans /= n;
    cout << ans << ' ' << count << endl;
    return 0;
}
